package com.SY7DA.dataSample;

import android.os.Message;
 
import com.SY7DA.dataSample.DataSample.serviceHandler;
//import com.SY7DA.socket.SocketUDPClient;
import com.SY7DA.socket.SocketUDPClient;

public class serviceCommunicateRunable implements Runnable{
	public final static int OPR_TYPE_None = -1;
	public final static int OPR_TYPE_GetCommunicateStatus = 100; 
	
	public final static int OPR_SUCCESS = 200;
	public final static int OPR_FALSE = 201;
	protected int mOprType = 0;
	
	protected serviceHandler srvHandler;
	
	public void setOprType(int type)
	{
		mOprType = type;
	}
	public void setHandler(serviceHandler hand)
	{
		srvHandler = hand;
	}
	@Override
	public void run() {
		// TODO Auto-generated method stub
		switch(mOprType)
		{
		case OPR_TYPE_GetCommunicateStatus:
			int iRet = SocketUDPClient.GetCommunicateStatus();
			Message msg = new Message();
			if(iRet==1)
			{
				msg.arg1 = OPR_SUCCESS;
			}else{
				msg.arg1 = OPR_FALSE;
			}
			msg.what = mOprType;
			 
			srvHandler.sendMessage(msg) ;
			break;
			
		}
	}
}